package threadsdemo;

import java.util.ArrayList;
import java.util.List;

public class Demo {


    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread() {
            @Override
            public void run() {
                while(!Thread.interrupted()) {
                    System.out.println(Thread.currentThread().getName());
//                    try {
                        new BlockingQueue().remove();
//                    } catch (InterruptedException e) {
//                        e.printStackTrace();
//                    }
                    Thread.yield();
                }
            }
        };

        thread.setDaemon(true);
        thread.setPriority(Thread.MAX_PRIORITY);
        thread.start();
        Thread.sleep(2000);
        thread.interrupt();

        thread.join();

        thread.suspend();
        thread.resume();
        thread.stop();
    }
}

class MonitorErrorDemo {
    private List monitor = new ArrayList<>();

    public void close() throws InterruptedException {
        synchronized (monitor) {
            wait();
        }
    }


    public static void main(String[] args) throws InterruptedException {
        new MonitorErrorDemo().close();
    }
}

